<template>
  <a-dropdown>
    <a class="ant-dropdown-link" @click="e => e.preventDefault()" style="color: #fff;">
      课程分类 <a-icon type="down" />
    </a>
    <a-menu slot="overlay" >
    
            <a-menu-item v-for="item in classifyList" :key="item.subjectId">
                <router-link :to="{path:'/search',query:{
                    subjectId: item.subjectId}}">
                    {{ item.subjectTitle }}
                </router-link>
            </a-menu-item>
    
      
    </a-menu>
  </a-dropdown>
</template>

<script>
import {getClassifyList} from '@/api/request'
export default {
        data(){
            return{
                classifyList:[]
            }
        },
        created(){
            getClassifyList().then(res=>{
                this.classifyList = res.rows
            })
        },
        methods: {
            
            /* searchCourse(keyword) {
                // 防止重复导航到相同路由
                if (this.$route.path === '/search' && this.$route.query.keyword === keyword) {
                    return;
                }
                this.$router.push({
                    path: '/search',
                    query: {
                        subjectId:keyword
                    }
                });
            } */
        },
};
</script>
